package com.brillilab.service.core.method.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.brillilab.dao.mapper.method.RecommendMethodSyncMapper;
import com.brillilab.domain.enums.method.RecommendMethodSyncStatesEnum;
import com.brillilab.domain.po.method.RecommendMethodSync;
import com.brillilab.service.core.method.IRecommendMethodSyncService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 推荐方法同步 服务实现类
 * </p>
 *
 * @author WuMenghao
 * @since 2019-06-11
 */
@Service
@Transactional
public class RecommendMethodSyncServiceImpl implements IRecommendMethodSyncService {

    @Resource
    private RecommendMethodSyncMapper recommendMethodSyncMapper;

    @Override
    public int insertBatch(List<RecommendMethodSync> syncs) {
        if(CollectionUtils.isNotEmpty(syncs)){
            return recommendMethodSyncMapper.insertBatch(syncs);
        }
        return 0;
    }

    @Override
    public RecommendMethodSync selectTopOne() {
        return recommendMethodSyncMapper.selectTopOne();
    }

    @Override
    public int update(RecommendMethodSync sync) {
        return recommendMethodSyncMapper.updateById(sync);
    }

    @Override
    public RecommendMethodSync selectById(Integer syncId) {
        return recommendMethodSyncMapper.selectById(syncId);
    }
}
